﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using PagedList;

namespace DemoUserInfo.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index(int? page)
        {
            ArticlesController art = new ArticlesController();
            var articles = from a in art.db.Articles select a;
            articles = articles.OrderByDescending(a => a.Date);
            int pageSize = 9;
            int pageNumber = (page ?? 1);
            return View(articles.ToPagedList(pageNumber, pageSize));
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }
    }
}